<?php $objDef=new objectDef('client');?>
<div class="showTable">
	<fieldset><legend><?php echo __('Coordinates')?></legend>
	
	<div align="right">
		<a href="http://www.score3.fr/<?php echo str_replace(' ','-',$self['nom']); ?>-<?php echo str_replace(' ','',$self['siret']); ?>.shtml">
		 <img src="http://www.score3.fr/score3.spng?siren=<?php echo str_replace(' ','',$self['siret']); ?>"/>
		</a>
	</div>
	<div style="width:100%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'code', 'span')?>
	</div>
	<div style="width:100%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'nom', 'span')?>
	</div>
	<div style="width:100%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'forme_juridique', 'span')?>
	</div>
	<div style="width:50%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'commercial', 'span')?>
	</div>	
	<div style="width:50%; float:right;">
	<?php $objDef->attributes['departement']['label']='Dpt.'?>
	<?php echo $objDef->renderAttribute($self, 'departement', 'span', array('style'=>'width:55px'))?>
	</div>
	<div style="width:100%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'adresse', 'span')?>
	</div>
	<div style="width:50%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'codpos', 'span')?>
	</div>	
	<div style="width:50%; float:right;">
	<?php echo $objDef->renderAttribute($self, 'ville', 'span', array('style'=>'width:55px'))?>
	</div>
	<div style="width:33%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'telephone', 'span')?>
	</div>		
	<div style="width:17%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'fax', 'span', array('style'=>'width:40px'))?>
	</div>	
	<div style="width:50%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'email', 'span', array('style'=>'width:55px'))?>
	</div>	
	<div style="width:50%; float:left;">
	<?php echo $objDef->renderAttribute($self, 'activite', 'span')?>
	</div>	
	<div style="width:50%; float:right;">
	<?php echo $objDef->renderAttribute($self, 'reseau', 'span', array('style'=>'width:55px'))?>
	</div>	
	</fieldset>
	<fieldset><legend><?php echo __('Customer Information')?></legend>
	<div style="width:50%; float:left;">
	<?php //echo $objDef->renderAttribute($self, 'dirigeant', 'span')?>
	<?php //echo $objDef->renderAttribute($self, 'fonction_dirigeant', 'span')?>
	<fieldset><legend><?php echo $objDef->renderLabel('contactes')?></legend>
	<?php $relatedObjectDef = new objectDef('contacte');?>
   	<?php echo $relatedObjectDef->renderListTable($self['contactes'], '', array(), false, false, false, false );?>
   	
	</fieldset>
	<?php echo $objDef->renderAttribute($self, 'datecreation', 'span')?>
   	<?php echo $objDef->renderAttribute($self, 'siret', 'span')?>
   	<?php echo $objDef->renderAttribute($self, 'encour', 'span')?>
   	<?php echo $objDef->renderAttribute($self, 'delais_paiement', 'span')?>
	</div>
	<div style="width:48%; float:right;">
	<fieldset><legend><?php echo $objDef->renderLabel('remises')?></legend>
	<?php $relatedObjectDef = new objectDef('remise');?>
   	<?php echo $relatedObjectDef->renderListTable($self['remises'], '', array(), false, false, false, false );?>
   	
	</fieldset>
	</div>
	
	<div style="width: 100%; float:none;">
	</div>
	<div style="width:70%; float:left;">
	<fieldset><legend>CA</legend>
	<div id="chiffre_affaires"></div>
	</fieldset>
	</div>
	<div style="width:30%; float:right;">
	<fieldset><legend><?php echo $objDef->renderLabel('concurrents')?></legend>
	<?php $relatedObjectDef = new objectDef('concurrent_client');?>
	<?php echo $relatedObjectDef->renderListTable($self['concurrents'], '', array(), false, false, false, false );?>
	</fieldset></div>
	<div style="width:100%; float:right;">
	<fieldset><legend><?php echo $objDef->renderLabel('observations')?></legend>
	<?php echo $objDef->renderAttributeValue($self, 'observations', 'span');//include_partial('client_tab4', array('self'=>$self, 'objDef' => $objDef, 'limit'=>3));  ?>
	</fieldset>
	</div>


	</fieldset>
</div>      
<hr />

<script type="text/javascript">
function getChiffres(){
	var xhr = getXmlHttpRequest2();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200)
			{
			var text = xhr.responseText;
			document.getElementById('chiffre_affaires').innerHTML = text;
		}
	};
	xhr.open("POST","<?php print url_for('reports/exportData'); ?>",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("id=1&format=html_service&client_id=" + <?php echo $self->id ;?>);	
}
getChiffres();

</script>